package com.jacky.me.jnidemo.calljni;

import android.util.Log;

/**
 * Created by jacky on 2017/4/11.
 * banker devel0per
 * <p></p>
 */
public class CLoadJMethod {
    private static final String TAG = "CLoadJMethod";

    static {
        System.loadLibrary("c-call-j");
    }

    //C调用java空方法
    public void helloFromJava() {
        Log.d(TAG, "helloFromJava:C/C++ 调用java空方法");
    }

    //C调用java中的带两个int参数的方法
    public int Add(int x, int y) {
        int result = x + y;
        Log.d(TAG, "Add:C/C++ 调用java中的带两个int参数的方法" + x + "+" + y + "=" + result);
        return result;
    }

    //C调用java中参数为string的方法
    public void printString(String s) {
        Log.d(TAG, "printString:C/C++ 调用java中参数为string的方法" + s);
    }

    public static void demo() {
        Log.d(TAG, "demo:C/C++ 调用java静态方法");
    }

    public native void callMethod1();

    public native void callMethod2();

    public native void callMethod3();

    public native void callMethod4();

    public native void callMethod5();

}
